/*
 * Copyright 1999-2017 Alibaba Group Holding Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// package com.alibaba.druid.sql.dialect.mysql.ast;

// import com.alibaba.druid.sql.ast.SQLExpr*;
// import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;

#include "MySqlUnique.h"
#include "../../../ast/SQLExpr.h"
#include "../../../ast/statement/SQLSelectOrderByItem.h"
#include "../visitor/MySqlASTVisitor.h"
#include "../../../../utils/listTran.h"

MySqlUnique::MySqlUnique()
{
}

void MySqlUnique::accept0(std::shared_ptr<MySqlASTVisitor > visitor)
{
  if (visitor->visit(SharedObject(MySqlUnique)))
  {
    acceptChild(visitor, this->getName());
    SQLObject_list_ptr  tmp = ListTran::tran_class<SQLSelectOrderByItem, SQLObject>(SQLUnique::getColumns());
    acceptChild(visitor, tmp);
  }
  visitor->endVisit(SharedObject(MySqlUnique));
}

SQLObject_ptr MySqlUnique::clone()
{
    SQLObject_ptr clone_tmp = MySqlUnique_ptr(new MySqlUnique());
    MySqlUnique_ptr x = std::dynamic_pointer_cast<MySqlUnique>(clone_tmp);
  // MySqlUnique *x = new MySqlUnique();
  cloneTo(x);
  return x;
}

SQLExpr_ptr MySqlUnique::getDbPartitionBy()
{
  return indexDefinition->getDbPartitionBy();
}

void MySqlUnique::setDbPartitionBy(SQLExpr_ptr x)
{
  indexDefinition->setDbPartitionBy(x);
}

BOOL_ptr MySqlUnique::isGlobal()
{
  return indexDefinition->isGlobal();
}

void MySqlUnique::setGlobal(BOOL_ptr global)
{
  indexDefinition->setGlobal(global);
}

BOOL_ptr MySqlUnique::isLocal()
{
  return indexDefinition->isLocal();
}

void MySqlUnique::setLocal(BOOL_ptr local)
{
  indexDefinition->setLocal(local);
}

SQLExpr_ptr MySqlUnique::getTablePartitions()
{
  return indexDefinition->getTbPartitions();
}

void MySqlUnique::setTablePartitions(SQLExpr_ptr x)
{
  indexDefinition->setTbPartitions(x);
}

SQLExpr_ptr MySqlUnique::getTablePartitionBy()
{
  return indexDefinition->getTbPartitionBy();
}

void MySqlUnique::setTablePartitionBy(SQLExpr_ptr x)
{
  indexDefinition->setTbPartitionBy(x);
}
